All Questions
19 questions
0votes
3answers
175views
Java exceptions that show the message when converted to String
I’m working with custom exceptions in Java for stack operations. However, I’m unsure if the exception handling is being handled properly, especially in terms of how exceptions are thrown and caught. ...
10votes
6answers
5kviews
Conway's Game of Life Object oriented implementation in Java
I have designed Conway's Game of Life in Java, the solution follows Object Oriented design and paradigm, please review and let me know the feedback Class Cell Cell ...
1vote
1answer
482views
Model animals using inheritance in Java
I was assigned the following problem: You've gone back in time to 500BC Athens and Socrates wants you to build him an app to help classify animals. Build the classes ...
2votes
1answer
1kviews
Modelling a Call Center in Java (multithreading approach)
I wanted to give a shot to Modelling a Call Center from Cracking the Coding Interview. The problem statement is as follows: You have a call center with three levels of employees: Respondent, Manager,...
3votes
2answers
178views
Design a sustainable home tracker and calibrater for power, water, gas to minimize the expense
Problem Statement Following are the various scenarios to be considered Track energy - Track consumption of water, gas and electricity. We should be able extend to capture other type of ...
4votes
1answer
5kviews
A tax calculator application to calculate tax and print final receipt
Although this question has been asked a lot of times, I was hoping for a feedback on my approach. Tax Calculator Basic sales tax is applicable at a rate of 10% on all goods, except books, food, ...
6votes
3answers
3kviews
Reverse Polish Notation calculator with unit tests
I had an interview with a global company yesterday. They had given me a programming assignment. I shared my screen and I must have finished the task in 1.5 hours. Task was programming Reverse Polish ...
1vote
2answers
2kviews
Given points on a 2D plane, find line that passes through the most points
Could someone give some feedbacks from perspective of oo design and coding style on the following codes: Question: Given n points on a 2D plane, find the Line with maximum number of points that lie ...
5votes
2answers
2kviews
Counting unique words, numbers, or phrases
I was given the below scenario to write a java program by a Software company. I did my best and was well tested as well. They came back rejecting my application without giving any review comments. I ...
14votes
2answers
28kviews
Elevator design (interview)
I believe interviews (~1 hour) commonly ask to code an elevator system, so this is my attempt. I made some requirements/assumptions: support one or more elevators accept pickup requests (think of up/...
3votes
2answers
5kviews
Designing a call center in object oriented way
Description: Below is one of the interview practice question. I think questions like these are to test the candidate's capability to write object oriented code. I being a candidate right now don't ...
7votes
2answers
207views
Load and analyze a list of people from a file
I recently completed a programming task in Java for a job that was javascript heavy but the hiring company wanted some Java knowledge. I've been using Java since the turn of the year. Other than ...
6votes
3answers
6kviews
Football game using factory and command patterns
I'm really confused about the interview I did with a firm. They told my code was not expert, but almost intermediate level java. Requirements Football Scoring Dashboard Develop an application that ...
8votes
1answer
1kviews
Designing yet another coffee machine, Lombok style
After reading Designing a coffee machine, I decided to implement the same problem as an exercise to get to know Guava and Lombok. I used the problem statement from the given question: Design a coffee ...
4votes
4answers
1kviews
Find Kth largest element in an array
I am preparing for interviews where my code would be judged based on optimizations, OOP concepts, code readability as well as my knowledge of JAVA and design patterns. What comments will you give in ...